<template>
	<view class="baseView" v-model="personInfo">
		<u-image
			style="align-self: center;margin: 16rpx;"
			width="200rpx"
			height="200rpx"
			:src="personInfo.avatar"
			shape="circle"
		>
			<u-loading slot="loading"></u-loading>
		</u-image>
		<view style="font-weight: bold; align-self: center;margin: 8rpx;">{{ personInfo.nickName }}</view>

		<u-cell-group>
			<u-cell-item title="个人设置" index="0" @click="clickItem"></u-cell-item>
			<u-cell-item title="会员等级" index="1" @click="clickItem"></u-cell-item>
			<u-cell-item title="修改密码" index="2" @click="clickItem"></u-cell-item>
			<u-cell-item title="意见反馈" index="3" @click="clickItem"></u-cell-item>
		</u-cell-group>
	</view>
</template>

<script>
export default {
	data() {
		return {
			personInfo: {}
		};
	},
	methods: {
		async gotoLogin() {
			let res = await this.$u.api.getPersonInfo();
			res.avatar = getApp()
				.globalData.baseUrl.concat('/prod-api/')
				.concat(res.avatar);
			getApp().globalData.person = res;
			this.personInfo = res;
		},
		clickItem: function(index) {
			uni.navigateTo({
				url: 'modifyInfo/modifyInfo'
			});
		}
	},
	onLoad() {
		this.gotoLogin();
		this.personInfo = this.getApp().globalData.person;
	},
	onShow() {
		//返回时再去读取
		console.log("========l")
		this.personInfo = getApp().globalData.person;
	}
};
</script>

<style></style>
